package com.atguigu.lease.admin.controller.system;

import com.atguigu.lease.admin.service.BrowsingHistoryService;
import com.atguigu.lease.model.dto.BrowserHistoryQueryDto;
import com.atguigu.lease.model.result.Response;
import com.atguigu.lease.model.vo.BrowsingHistoryItemVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "用户浏览记录管理模块")
@RestController
@RequestMapping("/admin/history")
public class BrowserHistoryController {

    @Autowired
    private BrowsingHistoryService browsingHistoryService;

    /**
     *  带条件分页查询  用户的浏览记录
     *      - userId
     *      - 时间区间：
     *      - 分页页码  每页记录数
     *  返回条件查询的分页数据：
     *         - 浏览记录需要展示房间的 房间号 和 房间的租金  和用户姓名
     *      ?k=v&k2=v2...
     *      
     */
    @Operation(summary = "查询用户的浏览记录")
    @GetMapping("page")
    public Response<Page<BrowsingHistoryItemVo>> page(BrowserHistoryQueryDto queryDto) {
        return Response.ok(browsingHistoryService.getBrowsingHistoryItemVoPage(queryDto));
    }
}
